<?php
/**
 * Created by PhpStorm.
 * User: 低调
 * Date: 2018/5/16
 * Time: 20:44
 */
//普通用户登录
include("../connectdb.php");
session_start();
if(isset($_POST['submit'])){
    $email=$_POST['email'];
    $sql="SELECT * FROM normalUser WHERE `email`= '$email'";
    $result=mysqli_fetch_array(mysqli_query($conn,$sql));
    if($result and $result['status']==0)
        echo "<script language=\"JavaScript\">alert('账号被管理员禁用');location.href=''</script>";
    elseif($_POST['password']==$result['password'] and $result['status']==1){
        $_SESSION['id'] = $result[0];
        $_SESSION['username'] = $result['username'];
        $_SESSION['email'] = $result['email'];
        echo "<script language=\"JavaScript\">alert('登录成功！正在跳转');location.href='index.php'</script>";
    }
    else
        echo "<script language=\"JavaScript\">alert('信息有误，请重试！');location.href=''</script>";
}
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>普通用户登录</title>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" type="text/css" href="../home/login/css/zui.css" media="all">
    <link rel="stylesheet" type="text/css" href="../home/login/css/login.css" media="all">
    <link href="../home/login/css/animate.min.css" rel="stylesheet">
    <link href="../home/login/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../home/login/css/style.css">
    <link rel="stylesheet" href="../home/login/css/layui.css">
    <script src="../home/login/js/CanvasAnimate.js"></script>
    <script src="../home/login/js/particles.min.js"></script>
    <script src="../home/login/js/layui.js"></script>
    <!-- 提示升级高级浏览器操作 -->
    <style>
        .ie-content{  position: fixed; left: 0; top: 0; right: 0; bottom:0; background:#fff; z-index: 1000;}
        .ie-content-bj{ width: 1000px; height: 380px; position: fixed; left: 50%; top: 36%; margin:-190px 0 0 -500px; background:url(img/sj.jpg) no-repeat; }
        .ie-list{ padding:168px 0 0 371px; }
        .ie-list a{ margin-right: 80px; }

        #particles-js {
            width: 100%;
            height: 100%;
            /* background: #000; */
            background-size: cover;
            background-position: 50% 50%;
            background-repeat: no-repeat;
        }
        .h{font-size:30px}
    </style>
</head>
<body class="body_bj">

<script language=JavaScript>
    function Checkpost(){
        if (form1.email.value==""){
            alert("邮箱不能为空");
            form1.email.focus();
            return false;
        }
        if(form1.password.value==""){
            alert("密码不能为空");
            form1.password.focus();
            return false;
        }
    }
</script>

<div id="particles-js">
    <div class="login">
        <div class="logo">
            <br>
            <h1 class="h">普通用户登录</h1>
        </div>
        <li class="login-list">
            <form action="" method="post" class="login-form" name="form1" onsubmit="return Checkpost()">
                <!-- 账号登陆 -->
                <div id="MobileBox" class="item-box">
                    <div class="input-group user-name"> <span class="input-group-addon"><i class="icon-user"></i></span>
                        <input type="text" name="email" class="form-control" placeholder="登录邮箱">
                    </div>
                    <div class="input-group password"> <span class="input-group-addon"><i class="icon-lock"></i></span>
                        <input type="password" name="password" class="form-control" placeholder="密码">
                    </div>

                    <br>
                    <div class="login_btn_panel">
                        <input class=" btn btn-primary btn-block btn-lg" type="submit" name="submit" value="登入">
                        <div class="check-tips"></div>
                    </div>

                    <br><br>
                    <div class="use-qrcode-a"><a href=""> 普通用户登录</a>
                        &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <a class="" href="../admin/login.php">管理员登录</a> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <a href="register.php">注册新账户</a>
                    </div>

                    <div class="tar">
                        <br>
                        <a href="forget.php">忘记密码?</a>
                    </div>

                </div>
            </form>
        </li>
    </div>
</div>

<script>
    layui.use(['jquery', 'layer'], function () {
        var $ = layui.jquery,
            layer = layui.layer;
    });
</script>
<script>
    particlesJS('particles-js',
        {
            "particles": {
                "number": {
                    "value": 40,  //数量
                    "density": {
                        "enable": true,
                        "value_area": 800
                    }
                },
                "color": {
                    "value": "#ffffff"
                },
                "shape": {
                    "type": "circle",
                    "stroke": {
                        "width": 0,
                        "color": "#000000"
                    },
                    "polygon": {
                        "nb_sides": 5
                    },
                    "image": {
                        "src": "img/github.svg",
                        "width": 100,
                        "height": 100
                    }
                },
                "opacity": {
                    "value": 0.3,
                    "random": false,
                    "anim": {
                        "enable": false,
                        "speed": 1,
                        "opacity_min": 0.1,
                        "sync": false
                    }
                },
                "size": {
                    "value": 3,
                    "random": true,
                    "anim": {
                        "enable": false,
                        "speed": 40,
                        "size_min": 0.1,
                        "sync": false
                    }
                },
                "line_linked": {
                    "enable": true,
                    "distance": 150,
                    "color": "#ffffff",
                    "opacity": 0.4,
                    "width": 1
                },
                "move": {
                    "enable": true,
                    "speed": 1,
                    "direction": "none",
                    "random": false,
                    "straight": false,
                    "out_mode": "out",
                    "bounce": false,
                    "attract": {
                        "enable": false,
                        "rotateX": 600,
                        "rotateY": 1200
                    }
                }
            },
            "interactivity": {
                "detect_on": "canvas",
                "events": {
                    "onhover": {
                        "enable": true,
                        "mode": "grab"
                    },
                    "onclick": {
                        "enable": false,
                        "mode": "push"
                    },
                    "resize": true
                },
                "modes": {
                    "grab": {
                        "distance": 150,
                        "line_linked": {
                            "opacity": 1
                        }
                    },
                    "bubble": {
                        "distance": 400,
                        "size": 40,
                        "duration": 2,
                        "opacity": 8,
                        "speed": 3
                    },
                    "repulse": {
                        "distance": 200,
                        "duration": 0.4
                    },
                    "push": {
                        "particles_nb": 4
                    },
                    "remove": {
                        "particles_nb": 2
                    }
                }
            },
            "retina_detect": false
        }
    );
</script>
</body>
</html>
